package br.com.nuccitec.jfera.basic;

import br.com.nuccitec.jfera.api.IRemoteResponse;
import br.com.nuccitec.jfera.business.AbstractBusinessExecutor;
import br.com.nuccitec.jfera.business.BusinessResponse;
import br.com.nuccitec.jfera.business.IBusinessPrefixExecutor;
import br.com.nuccitec.jfera.validation.vo.AbstractVO;

public class GenericDeleteExecutor extends AbstractBusinessExecutor implements IBusinessPrefixExecutor {
	public static final String DELETE_GENERIC = "DELETE_GENERIC";

	@Override
	public IRemoteResponse execute(Object objVO) {
		AbstractVO vo = (AbstractVO) objVO;
		getColaborator().logInfo(getClass(), vo.toString());
		vo.setColaborator(getColaborator());
		vo.deleteFromDB();
		return new BusinessResponse(objVO);
	}

	@Override
	public String requestPrefixToAttend() {
		return DELETE_GENERIC;
	}
}
